﻿<Page x:Class="EffectsTester.Pages.ColorBlindness"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:fx="http://LearnWPF.com/Effects"
    xmlns:local="clr-namespace:EffectsTester"  
    Title="ColorBlindness">
    <DockPanel>
        
        <Border DockPanel.Dock="Top">
            <ComboBox x:Name="_combo" MaxWidth="300">
                <ComboBoxItem IsSelected="True" DataContext="Normal" Content="Normal" />
                <ComboBoxItem DataContext="Protanopia" Content="Protanopia" />
                <ComboBoxItem DataContext="Protanomaly" Content="Protanomaly" />
                <ComboBoxItem DataContext="Deuteranopia" Content="Deuteranopia" />
                <ComboBoxItem DataContext="Deuteranomaly" Content="Deuteranomaly" />
                <ComboBoxItem DataContext="Tritanopia" Content="Tritanopia" />
                <ComboBoxItem DataContext="Tritanomaly" Content="Tritanomaly" />
                <ComboBoxItem DataContext="Achromatopsia" Content="Achromatopsia" />
                <ComboBoxItem DataContext="Achromatomaly" Content="Achromatomaly" />
            </ComboBox>
        </Border>
        
        <Border Margin="10">
            <TabControl>
                <TabItem Header="Test Control">
                    <Border>
                        <Border.Effect>
                            <fx:ColorBlindnessEffect ColorDeficiency="{Binding ElementName=_combo, Path=SelectedItem.DataContext}" />
                        </Border.Effect>
                        <local:TestControl />
                    </Border>
                </TabItem>
                
                <TabItem Header="Rainbow">
                    <WrapPanel>
                        
                        <StackPanel Width="300" Margin="10">
                            <TextBlock Margin="20" Text="Normal" FontSize="16pt" FontWeight="Bold" TextAlignment="Center" />
                            
                            <Border Height="45" Background="Red" />
                            <Border Height="45" Background="Orange" />
                            <Border Height="45" Background="Yellow" />
                            <Border Height="45" Background="Green" />
                            <Border Height="45" Background="Blue" />
                            <Border Height="45" Background="Purple" />
                        </StackPanel>

                        <StackPanel Width="300" Margin="10">
                            <TextBlock Margin="20" Text="{Binding ElementName=_combo, Path=SelectedItem.Content}" TextAlignment="Center" FontSize="16pt" FontWeight="Bold" />
                            
                            <Border Height="45" Background="Red" />
                            <Border Height="45" Background="Orange" />
                            <Border Height="45" Background="Yellow" />
                            <Border Height="45" Background="Green" />
                            <Border Height="45" Background="Blue" />
                            <Border Height="45" Background="Purple" />
                            
                            <StackPanel.Effect>
                                <fx:ColorBlindnessEffect ColorDeficiency="{Binding ElementName=_combo, Path=SelectedItem.DataContext}" />
                            </StackPanel.Effect>
                        </StackPanel>
                    </WrapPanel>
                </TabItem>
            </TabControl>
        </Border>
    </DockPanel>
</Page>
